package com.hk.web.controller;

import org.springframework.stereotype.Component;

import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by Antinomy on 16/10/13.
 */

@Component
public class Routes {
    private Map<String, String> paths = new ConcurrentHashMap<>();


    public Routes() throws IllegalAccessException {
        Field[] fields = this.getClass().getFields();
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            paths.put(field.getName(), (String) field.get(this));
        }
    }

    public String path(String key) {
        return paths.get(key);
    }

    public static final String HTTP_METHOD_GET = "GET";
    public static final String HTTP_METHOD_POST = "POST";

    public static final String API = "/api/**";
    public static final String AUTH = "/api/auth";
    public static final String AUTH_USER = "/user/{mobile}";
    public static final String AUTH_CHANGE_PWD = "/user/{mobile}/pwd";
    public static final String AUTH_FORGET_PWD = "/user/{mobile}/pwd/forget";


    public static final String CAPTCHA = "/api/captcha";
    public static final String CAPTCHA_CODE = "/{verifySource}";
    public static final String CAPTCHA_VERIFICATION = "/{verifySource}/verifyCode";

    public static final String ARTICLE = "/api/article";
    public static final String ARTICLE_UPDATE = "/api/article/{id}";
    public static final String ARTICLE_DETAIL = "/api/article/{uuid}";
    public static final String ARTICLE_DETAIL_UUID = "/api/article/uuid/{uuid}";
    public static final String ARTICLE_TYPE_LIST = "/api/article/type/{type}";
    public static final String ARTICLE_TOP_LIST = "/api/article/top/{type}";
    public static final String ARTICLE_TYPE_LIST_ALL = "/api/article/type/{type}/all";
    public static final String ARTICLE_LIST_ALL = "/api/article/list/all";

    public static final String API_ARTICLE_UUID_CHANGE_ON_TOP = "/api/article/{uuid}/changeOnTop";
    public static final String API_ARTICLE_UUID_DELETE = "/api/article/{uuid}/delete";

    public static final String FLASHVIEW_PC_LIST = "/api/facade/fashview/pc";
    public static final String FLASHVIEW_PC_PROD_LIST = "/api/facade/fashview/pc/product";
    public static final String COMPANY_DEVELOPMENT_LIST = "/api/facade/company/development";
    public static final String COMPANY_GLORIES_LIST = "/api/facade/company/glories";
    public static final String COMPANY_LEADER_LIST = "/api/facade/company/leader";
    public static final String COMPANY_TEAM_LIST = "/api/facade/company/team";
    public static final String COMPANY_JOBS_LIST = "/api/facade/company/jobs";
    public static final String COMPANY_WEEKLY_VIEW_LIST = "/api/facade/company/weeklyView";

    public static final String UPLOAD = "/api/upload";
    public static final String UPLOAD_CONTRACT = "/api/upload/contract";

    public static final String USER_ROLE_LIST = "/api/userRole/list";
    public static final String USER_ROLE_CREATE = "/api/userRole/create";
    public static final String USER_ROLE = "/api/userRole/{roleId}";
    public static final String USER_ROLE_DELETE = "/api/userRole/{roleId}/delete";

    public static final String USER_ASSIGN_ROLE = "/api/user/assignRoles";
    public static final String ROLE_ASSIGN_MENU = "/api/role/assignMenus";

    public static final String AUTH_MENU = "/api/auth/menu";
    public static final String AUTH_MENU_ROLE = "/api/auth/menu/role";
    public static final String AUTH_MENU_ROLE_IDS = "/api/auth/menu/role/ids";


    /* Open API */
    public static final String API_MERCHANT_GET_ACCOUNT_BY_MOBILE = "/api/merchant/getAccountByMobile";

    /* BackEnd */
    public static final String MERCHANT_BACKEND_CREATE = "/api/merchant/backend/create";
    public static final String API_MERCHANT_BACKEND_CHANGE_FEATURE_TOGGLES = "/api/merchant/backend/changeFeatureToggles";

    /* FrontEnd */
    public static final String API_MERCHANT_FRONTEND_HUAKANGYUN_INSURANCE = "/api/merchant/frontend/huakangyun/insurance";
    public static final String API_MERCHANT_FRONTEND_APP_FEATURE_TOGGLES = "/api/merchant/frontend/appFeatureToggles";
    public static final String API_GESTURE_CIPHER_GETPUSHMESSAGE = "/api/userinfo/getPushMessage";
    public static final String API_GESTURE_CIPHER_GETCIPHERSTATE= "/api/userinfo/getCipherState";
    public static final String API_GESTURE_CIPHER_SAVEGESTURECIPHER = "/api/userinfo/saveGestureCipher";
    public static final String API_GESTURE_CIPHER_MODIFYGESTURECIPHER = "/api/userinfo/modifyGestureCipher";
    public static final String API_GESTURE_CIPHER_SWITCHGESTURECIPHERSTATE = "/api/userinfo/switchGestureCipherState";
    public static final String API_GESTURE_CIPHER_CLEANGESTURECIPHER = "/api/userinfo/cleanGestureCipher";
    public static final String API_GESTURE_CIPHER_FORGETGESTURECIPHER = "/api/userinfo/forgetGestureCipher";






    public static final String API_OPTION_DETAILS_ARTICLE_TYPE = "/api/optionDetails/articleType";
    public static final String API_OPTION_DETAILS_OPERATION_EVENT = "/api/optionDetails/operationEvent";

    public static final String API_BACKEND_OPERATION_LOGGING = "/api/backend/operationLogging";

}
